﻿using WeDonekRpc.Client.Attr;
using WeDonekRpc.Helper.Config;

namespace Basic.FlowCollect.Config
{
    [ClassLifetimeAttr(ClassLifetimeType.SingleInstance)]
    internal class FlowAppPowerConfig : IFlowAppPowerConfig
    {
        public FlowAppPowerConfig(IConfigCollect config)
        {
            IConfigSection section = config.GetSection("AppPower");
            section.AddRefreshEvent(this._Init);
        }

        private void _Init(IConfigSection section, string name)
        {
            this.RoutePath = section.GetValue<string>("RoutePath", "/flow/app/page/:id");
            this.RouteName = section.GetValue<string>("RouteName", "appPage");
            this.PagePath = section.GetValue<string>("PagePath", "flow/views/flowAppPage/appPage");
        }
       
        /// <summary>
        /// 页面路由路径
        /// </summary>
        public string RoutePath { get; private set; }

        /// <summary>
        /// 页面路由名
        /// </summary>
        public string RouteName { get; private set; }

        /// <summary>
        /// 页面路径
        /// </summary>
        public string PagePath { get; private set; }
    }
}
